import 'package:bitcoin_mine/common/global.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../controllers/fission_controller.dart';
import '../l10n/app_localizations.dart';

class InvitationLinks extends StatelessWidget {
  const InvitationLinks({super.key});

  @override
  Widget build(BuildContext context) {
    final FissionController controller = Get.find();
    final l10n = AppLocalizations.of(context);

    return Container(
      margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.h),
      child: Column(
        children: [
          // 邀请链接
          // Container(
          //   padding: EdgeInsets.only(left: 16.w),
          //   height: 50.h,
          //   decoration: BoxDecoration(
          //     image: DecorationImage(
          //       image: AssetImage("assets/images/bg_section.png"),
          //       fit: BoxFit.fill,
          //     ),
          //   ),
          //   child: Row(
          //     crossAxisAlignment: CrossAxisAlignment.center,
          //     children: [
          //       Expanded(
          //         child: Column(
          //           crossAxisAlignment: CrossAxisAlignment.start,
          //           mainAxisAlignment: MainAxisAlignment.center,
          //           children: [
          //             Text(
          //               l10n.invitationLink,
          //               style: TextStyle(
          //                 color: Colors.white70,
          //                 fontSize: 12.sp,
          //                 fontWeight: FontWeight.w500,
          //               ),
          //             ),
          //           ],
          //         ),
          //       ),
          //       Obx(
          //         () => Text(
          //           controller.invitationLink.value,
          //           style: TextStyle(
          //             color: Colors.white,
          //             fontSize: 14.sp,
          //             fontWeight: FontWeight.w600,
          //           ),
          //         ),
          //       ),
          //       SizedBox(width: 10.w),
          //       GestureDetector(
          //         onTap: () => controller.copyInvitationLink(),
          //         child: Container(
          //           alignment: Alignment.center,
          //           width: 78.w,
          //           height: 50.h,
          //           decoration: BoxDecoration(
          //             image: DecorationImage(
          //               image: AssetImage("assets/images/bg_code_btn.png"),
          //               fit: BoxFit.fill,
          //             ),
          //           ),
          //           child: Text(
          //             l10n.copy,
          //             style: TextStyle(
          //               color: const Color(0xFF00FFFF),
          //               fontSize: 12.sp,
          //               fontWeight: FontWeight.w600,
          //             ),
          //           ),
          //         ),
          //       ),
          //     ],
          //   ),
          // ),

          // SizedBox(height: 12.h),

          // 邀请码
          Container(
            padding: EdgeInsets.only(left: 16.w),
            height: 50.h,
            decoration: BoxDecoration(
              image: DecorationImage(
                image: AssetImage("assets/images/bg_section.png"),
                fit: BoxFit.fill,
              ),
            ),
            child: Row(
              children: [
                Expanded(
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Text(
                        l10n.invitationCode,
                        style: TextStyle(
                          color: Colors.white70,
                          fontSize: 12.sp,
                          fontWeight: FontWeight.w500,
                        ),
                      ),
                    ],
                  ),
                ),
                Obx(
                  () => Text(
                    Global.user.value?.user_info?.invitation_code ?? '',
                    style: TextStyle(
                      color: Colors.white,
                      fontSize: 14.sp,
                      fontWeight: FontWeight.w600,
                    ),
                  ),
                ),
                SizedBox(width: 10.w),
                GestureDetector(
                  onTap: () => controller.copyInvitationCode(),
                  child: Container(
                    alignment: Alignment.center,
                    width: 78.w,
                    height: 50.h,
                    decoration: BoxDecoration(
                      image: DecorationImage(
                        image: AssetImage("assets/images/bg_code_btn.png"),
                        fit: BoxFit.fill,
                      ),
                    ),
                    child: Text(
                      l10n.copy,
                      style: TextStyle(
                        color: const Color(0xFF00FFFF),
                        fontSize: 12.sp,
                        fontWeight: FontWeight.w600,
                      ),
                    ),
                  ),
                ),
              ],
            ),
          ),

          SizedBox(height: 16.h),

          // 邀请奖励说明
          Text(
            l10n.inviteRewardMessage,
            textAlign: TextAlign.center,
            style: TextStyle(
              color: const Color(0xFF05FFFD),
              fontSize: 15.sp,
              fontWeight: FontWeight.w400,
            ),
          ),

          SizedBox(height: 16.h),

          // 立即邀请按钮
          GestureDetector(
            onTap: () => controller.invite(),
            child: Container(
              width: 184.w,
              height: 54.h,
              decoration: BoxDecoration(
                image: DecorationImage(
                  image: AssetImage("assets/images/btn_invite_now.png"),
                  fit: BoxFit.fill,
                ),
              ),
              child: Center(
                child: Text(
                  l10n.inviteNow,
                  style: TextStyle(
                    color: const Color(0xFFFFFFFF),
                    fontSize: 16.sp,
                    fontWeight: FontWeight.w600,
                  ),
                ),
              ),
            ),
          ),
        ],
      ),
    );
  }
}
